﻿<template>
	<transition name="el-zoom-in-center">
		<div class="SHZY-preview-main">
			<div class="SHZY-common-page-header">
				<el-page-header @back="goBack" :content="title" />
				<div class="options">
					<el-button @click="goBack()">{{ $t('common.cancelButton') }}</el-button>
				</div>
			</div>
			<el-form label-width="100px" class="main">
				<el-form-item label-width="0" class="value-item">
					<el-input v-model="data" type="textarea" :rows="30" readonly />
				</el-form-item>
			</el-form>
		</div>
	</transition>
</template>
  
<script>
import { getInterfaceLogInfo } from '@/api/system/interface/log'
export default {
	data() {
		return {
			visible: false,
			data: '',
			title: '参数信息'
		}
	},
	methods: {
		init(id, type, title) {
			this.title = title
			this.visible = true
			this.$nextTick(() => {
				getInterfaceLogInfo(id).then(res => {
					try {
						this.data = JSON.stringify(JSON.parse(res.data[type]), null, '\t')
					} catch {
						this.data = res.data[type];
					}
				})
			});
		},
		goBack() {
			this.$emit('close')
		}
	}
}
</script>
<style lang="scss" scoped>
.main {
	display: flex;
	flex-direction: column;

	.value-item {
		flex: 1;
		margin-bottom: 0;

		>>>.el-form-item__content {
			height: 100%;

			.el-textarea {
				height: 100%;

				.el-textarea__inner {
					height: 100%;
				}
			}
		}
	}
}
</style>